USE [TestDB]
GO
/****** Object: StoredProcedure [dbo].[GetSQLBeeValues] Script Date: 12/09/2005 08:50:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[GetSQLBeeValues]
-- Add the parameters for the function here
@ByRows bit = 1
--<@Param2, sysname, @p2> <Datatype_For_Param2, , int> = <Default_Value_For_Param2, , 0>
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
waitfor delay '00:00:01'
-- Insert statements for procedure here
--SELECT @p1, @p
Declare @TS datetime
Set @TS = GetUtcDate()
if @ByRows = 1
begin
Declare @RandomTable TABLE
(ItemName varchar(64), ItemValue varchar(128), ItemTimestamp datetime)
insert into @RandomTable select 'BoolValue', cast(round(Rand(), 0) as varchar(128)), @TS
insert into @RandomTable select 'FloatValue', cast(10*RAND() as varchar(128)), @TS
insert into @RandomTable select 'StringValue', 'row X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV', @TS
insert into @RandomTable select 'DateValue', cast(getDate() as varchar(128)), @TS
insert into @RandomTable select 'BoolValue2', cast(round(Rand(), 0) as varchar(128)), @TS
insert into @RandomTable select 'FloatValue2', cast(10*RAND() as varchar(128)), @TS
insert into @RandomTable select 'StringValue2', 'row X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV', @TS
insert into @RandomTable select 'DateValue2', cast(getDate() as varchar(128)), @TS
insert into @RandomTable select 'BoolValue3', cast(round(Rand(), 0) as varchar(128)), @TS
insert into @RandomTable select 'FloatValue3', cast(10*RAND() as varchar(128)), @TS
insert into @RandomTable select 'StringValue3', 'row X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV', @TS
insert into @RandomTable select 'DateValue3', cast(getDate() as varchar(128)), @TS
insert into @RandomTable select 'BoolValue4', cast(round(Rand(), 0) as varchar(128)), @TS
insert into @RandomTable select 'FloatValue4', cast(10*RAND() as varchar(128)), @TS
insert into @RandomTable select 'StringValue4', 'row X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV', @TS
insert into @RandomTable select 'DateValue4', cast(getDate() as varchar(128)), @TS
insert into @RandomTable select 'BoolValue5', cast(round(Rand(), 0) as varchar(128)), @TS
insert into @RandomTable select 'FloatValue5', cast(10*RAND() as varchar(128)), @TS
insert into @RandomTable select 'StringValue5', 'row X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV', @TS
insert into @RandomTable select 'DateValue5', cast(getDate() as varchar(128)), @TS
insert into @RandomTable select 'StringArray', '[2] tkst-' +cast(round(100*RAND(), 0) as varchar(128)) + '; tkst-' + cast(round(100*RAND(), 0) as varchar(128)) + ';', @TS
insert into @RandomTable select 'DoubleArray', '[2] ' + cast(100*RAND() as varchar(128)) + '; ' + cast(100*RAND() as varchar(128)) + ';', @TS
select * from @RandomTable
end
else
begin
Select
cast(round(Rand(), 0) as bit) as 'ColBoolValue',
10*RAND() as 'ColFloatValue',
'column X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV' as 'ColStringValue',
getDate() as 'ColDateValue',
cast(round(Rand(), 0) as bit) as 'ColBoolValue2',
10*RAND() as 'ColFloatValue2',
'column X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV' as 'ColStringValue2',
getDate() as 'ColDateValue2',
cast(round(Rand(), 0) as bit) as 'ColBoolValue3',
10*RAND() as 'ColFloatValue3',
'column X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV' as 'ColStringValue3',
getDate() as 'ColDateValue3',
cast(round(Rand(), 0) as bit) as 'ColBoolValue4',
10*RAND() as 'ColFloatValue4',
'column X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV' as 'ColStringValue4',
getDate() as 'ColDateValue4',
cast(round(Rand(), 0) as bit) as 'ColBoolValue5',
10*RAND() as 'ColFloatValue5',
'column X' +cast(round(100*RAND(), 0) as varchar(128)) + 'XEV' as 'ColStringValue5',
getDate() as 'ColDateValue5',
'[2] tkst-' +cast(round(100*RAND(), 0) as varchar(128)) + '; tkst-' + cast(round(100*RAND(), 0) as varchar(128)) + ';' as 'StringArray',
'[2] ' + cast(100*RAND() as varchar(128)) + '; ' + cast(100*RAND() as varchar(128)) + ';' as 'DoubleArray'
end
END